package com.andryu.grifika.module

import com.andryu.base.constant.CommonConstants
import com.andryu.base.entity.LearnListEntity
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Named
import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
object GrifikaDataModule {

    const val TAG = "GrifikaModule";

    @Provides
    @Singleton
    @Named("GrifikaList")
    fun provideGrifikaList(): MutableList<LearnListEntity> {
        val mDataList = mutableListOf<LearnListEntity>()

        return mDataList
    }

    @Provides
    @Singleton
    @Named("GrifikaLastThree")
    fun provideGrifikaTopThree(): List<LearnListEntity> {
        return provideGrifikaList()
            .filter { it.type == CommonConstants.LEARN_INFO_CONTENT }
            .reversed()
            .take(3)
    }
}